extends "../lisailiu-3/lisailiu-3.gd"


var baseId = ""
var upText1 = "爱丽丝之帜范围+1"
var upText2 = "爱丽丝之焰冷却时间-2秒"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("<固化><唯一>每13秒对所有敌人造成12%血上限的真实伤害，并使其血上限降低8%(以初始血上限为准)", "爱丽丝之焰")

func upgrade():
	.upgrade()
	if upgraded == 1:
		p3 = 4
	if upgraded == 2:
		skCd4 = 11

var skCd4 = 13
var flag = 0
func _upS():
	._upS()
	flag += 1
	if flag >= skCd4:
		aliceFlame()
		flag = 0

func _onBattleStart():
	._onBattleStart()
	flag = 0

func aliceFlame():
	utils.createSkillTextEff("爱丽丝之焰", position)
	var chas = getAllChas(1)
	for i in chas:
		var buff = i.hasBuff("b_lsl_alszy")
		var dmg = min(0.5, 0.12 + att.atk/1000.0 * 0.1)
		if team == 1:
			azurHurtChara(i, i.att.maxHp*dmg, sys.HurtType.REAL, Chara.AtkType.EFF, "爱丽丝之焰")
		# else:
		# 	azurHurtChara(i, i.att.maxHp*min(0.5, dmg), sys.HurtType.WEAPON, Chara.AtkType.EFF, "爱丽丝之焰")
		if buff == null:
			i.addBuff(b_lsl_alszy.new())

class b_lsl_alszy:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	var initHp
	func _init():
		attInit()
		id = "b_lsl_alszy"	
		att.maxHpL = -0.08
		buffName = "爱丽丝之焰"
		dispel = 2
	func incr():
		if masCha.team == 1:
			att.maxHpL -= 0.02
		else:
			att.maxHpL -= 0.08
	var index = 0
	func _upS():
		index += 1
		if index >= 10:
			index = 0
			incr()
		if masCha.att.hp < 0:
			masCha.hurtChara(masCha, 1, sys.HurtType.REAL, sys.AtkType.EFF)